import Vue from 'vue'
import App from './App.vue'
import router from './router/index'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css';// 默认主题
import './assets/css/icon.css';
import 'normalize.css'
import './mock/mock'
import store from './store/index'

// import Cookies from 'js-cookie'
Vue.config.productionTip = false
// 设置路由拦截
// router.beforeEach((to, from, next) => {
//   let name = Cookies.get('name') || store.state.name
//   // 如果cookie没有过期或者store中有name值,则允许访问直接通过。否则就让用户登录
//   if (name) {
//     store.commit('loginIn', name)
//     next()
//   } else {
//     if (to.path == '/login') {
//       next()
//     } else {
//       next({
//         name: 'Login'
//       })
//       store.commit('loginOut')
//     }
//   }
// })

Vue.use(ElementUI, {
  size: 'small'
});
router.afterEach(() => { })
new Vue({
  router,
  store,
  render: h => h(App),
}).$mount('#app')
